<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <h:head>
        <title><ui:insert name="title">Embrapa Soja</ui:insert></title>
        <h:outputStylesheet name="css/jsfcrud.css"/>
        <h:outputStylesheet library="css" name="jsfcrud.css"/>
        <h:outputScript library="js" name="jsfcrud.js"/>      
    </h:head>

    <h:body>
        
        <p:growl id="growl" life="3000" />

        <p:layout fullPage="true">
            
            <p:layoutUnit position="north" style="padding-top:0;">
                <div class="divHeader">
                    <img src="/embrapa/faces/i_logo.png" alt="Embrapa Soja" id="logotipo"/>
                </div>
            </p:layoutUnit>
            
            <p:layoutUnit position="west" size="180">
                <f:metadata>
                     <f:event listener="#{usuarioController.TestaLogin}" type="preRenderComponent" />
                </f:metadata> 
                <h:form id="menuForm">
                    
                    <div id="TbInstListForm:j_idt43" class="ui-breadcrumb ui-module ui-widget ui-widget-header ui-helper-clearfix ui-corner-all" role="menu">
                        <ul>
                            <li role="menuitem">
                                <p:commandButton icon="ui-icon-home" style="display:block; margin-bottom:10px; margin-left:5px; height:22px; width:30px;" actionListener="#{usuarioController.NavegarHome}" update=":growl" />
                            </li>
                            <li role="menuitem">
                                <p:commandButton icon="ui-icon-person" style="display:block; margin-bottom:10px; margin-left:5px; height:22px; width:30px;" actionListener="#{usuarioController.NavegarUser}" update=":growl" />
                            </li>
                            <li role="menuitem">
                                <p:commandButton icon="ui-icon-help" style="display:block; margin-bottom:10px; margin-left:5px; height:22px; width:30px;" actionListener="#{usuarioController.NavegarHelp}" update=":growl" />
                            </li>
                            <li role="menuitem">
                                <p:commandButton icon="ui-icon-power" style="display:block; margin-bottom:10px; margin-left:5px; height:22px; width:30px;" actionListener="#{usuarioController.Logout}" update=":growl" />
                            </li>
                        </ul>                    
                    </div>                    
                    
                    <p:panelMenu>
                        <p:submenu label="Operacional">
                            <p:menuitem value="Cliente" outcome="/tbInst/List.xhtml" />
                        </p:submenu>
                        <p:submenu label="Cadastro">
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Cargo" outcome="/cargo/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Categoria" outcome="/categoria/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Finalidade Visita" outcome="/finalidadeVisita/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Área De Interesse" outcome="/interesses/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Profissão / Formação" outcome="/profissaoFormacao/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Sub Categoria" outcome="/subcategoria/List.xhtml" />
                        </p:submenu>
                        <p:submenu label="Consulta">
                            <p:menuitem value="Cliente" outcome="/Consultas/ConsultaCliente.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Evento / Participante" outcome="/Consultas/ConsultaEvento.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Funcionário" outcome="/Consultas/ConsultaFuncionario.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="SAC" outcome="/Consultas/ConsultaSAC.xhtml" />
                            <p:menuitem value="Visita" outcome="/Consultas/ConsultaVisita.xhtml" />
                        </p:submenu>    
                        <p:submenu rendered="#{sessionScope.user.funcao == 'Administrador'}" label="Integração">
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Participante Evento" outcome="/integracao/Eventos.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="SAC" outcome="/integracao/SAC.xhtml" />
                        </p:submenu>    
                        <p:submenu label="Sistema">
                            <p:menuitem value="Mural" outcome="/sistemas/mural.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Sistema"  outcome="/sistemas/List.xhtml" />
                            <p:menuitem rendered="#{sessionScope.user.funcao == 'Administrador'}" value="Usuário" outcome="/usuario/List.xhtml" />
                        </p:submenu>    
                    </p:panelMenu>
                    <br />
                    <p align="center">Usuário logado <b>#{sessionScope.user.login}</b></p>
                </h:form>
            </p:layoutUnit>

            <p:layoutUnit position="south">
                <ui:insert name="footer"/>
                <p:layout>
                    <p:layoutUnit position="center" size="50%" style="border:none; height: 45px;">
                        <p align="center">
                            Empresa Brasileira de Pesquisa Agropecuária - Embrapa
                            . Todos os direitos reservados, conforme Lei no 9.610
                            . www.embrapa.br
                        </p>
                    </p:layoutUnit>
                </p:layout>
            </p:layoutUnit>

            <p:layoutUnit position="center">
                <ui:insert name="body"/>       
            </p:layoutUnit>

        </p:layout>

    </h:body>

</html>
